package com.jwthhealth_pub.old.report.util.request;


import com.jwthhealth_pub.old.report.model.resbody.HraDataRes;
import com.jwthhealth_pub.old.report.model.resbody.HraDateRes;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Field;

public class RequestHelper implements RequestService {

//    private static final String BASEURL = "http://192.168.1.206/api/";
    private static final String BASEURL = "http://www.jwth-health.com/api/";
    private static RequestService mRequestHelper;

    public static void init() {
//        Gson gson = new GsonBuilder()
//                .setLenient()
//                .create();

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(BASEURL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        mRequestHelper = retrofit.create(RequestService.class);
    }

    public static RequestService getmRequestHelper() {
        return mRequestHelper;
    }

    @Override
    public Call<HraDateRes> getHraDate(@Field("dev") String deviceId, @Field("mac") String macAddress, @Field("uid") String uid, @Field("sign") String cKey) {
        return mRequestHelper.getHraDate(deviceId, macAddress, uid, cKey);
    }

    @Override
    public Call<HraDataRes> getHraData(@Field("dev") String deviceId, @Field("mac") String macAddress, @Field("uid") String uid, @Field("id") String id, @Field("sign") String cKey) {
        return mRequestHelper.getHraData(deviceId, macAddress, uid, id, cKey);
    }

}
